package com.wpj.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.wpj.entity.Goods;
import com.wpj.service.ISearchService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping(value = "/search")
public class SearchController {

    @Reference
    private ISearchService searchService;

    @RequestMapping(value = "/searchGoods")
    public String searchGoods(String key, ModelMap map){
        System.out.println("SearchController.searchGoods "+key);
        List<Goods> goodsList = searchService.searchGoodsListByKey(key);
        map.put("goodsList",goodsList);
        return "searchGoodsList";
    }

}
